<template>
  <div class="search-camp">
    <div class="search-head">
      <i class="iconfont icon-fanhui" v-on:click="goback()"></i>
      <div class="inp-box">
        <div class="icon-find">
          <i class="iconfont icon-sousuo"></i>
        </div>
        <input type="text" v-bind:value="words" v-on:click="turnfoodfind()"/>

        <!-- 搜索和icon-del都返回food-search   复用得有个判断，food中没有这个-->
        <div class="icon-del" v-on:click="turnfoodfind1()">
          <i class="iconfont icon-quxiao"></i>
        </div>
      </div>
      <div class="sousuo-text">
        <!-- 搜索 -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    words: {
      type: String,
    },
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    turnfoodfind(){
      this.$router.push({name:'Food-search',params:{words:this.words}});
    },
    turnfoodfind1(){
      // this.words = ""
      this.$router.push({name:'Food-search',params:{words:""}});
      
    }
  },
};
</script>

<style lang="scss">
.search-camp {
  width: 100%;
  padding: 10px;
  height: 50px;
  box-sizing: border-box;
  position: fixed;
  background-color: white;
  .search-head {
    height: 30px;
    width: 100%;
    // background-color: red;
    display: flex;
    font-size: 0;

    box-sizing: border-box;
    justify-content: space-between;
    .icon-fanhui {
      height: 30px;
      font-size: 30px;
      line-height: 30px;
      text-align: center;
    }
    .inp-box {
      height: 30px;
      width: 70%;
      // background-color: red;
      display: flex;
      font-size: 0;
      background-color: #f5f5f5;
      justify-content: space-between;

      .icon-find {
        height: 30px;
        width: 30px;
        text-align: center;
        i {
          height: 30px;
          font-style: 30px;
          line-height: 30px;
        }
      }
      input {
        border: 0;
        outline: none;
        background-color: #f5f5f5;
      }
      .icon-del {
        font-size: 0;
        height: 30px;
        width: 30px;
        text-align: center;
        i {
          height: 30px;
          font-size: 20px;
          line-height: 30px;
        }
      }
    }

    .sousuo-text {
      width: 15%;
      height: 30px;
      line-height: 30px;
      font-size: 16px;
      text-align: center;
    }
  }
}
</style>